﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public class SelcetionFactory
	{
		public XYZ Min
		{
			get
			{
				return this.auxiliarySelection.Min;
			}
		}

		public XYZ Max
		{
			get
			{
				return this.auxiliarySelection.Max;
			}
		}

		public XYZ AnglePt
		{
			get
			{
				return this.auxiliarySelection.AnglePt;
			}
		}

		public XYZ SelectPoint
		{
			get
			{
				return this.auxiliarySelection.SelectPoint;
			}
		}

		public Element SelectElement
		{
			get
			{
				return this.auxiliarySelection.SelectElement;
			}
		}

		public SelcetionFactory(ExternalCommandData camdArgu, AuxiliarySelectType selectionType)
		{
			switch (selectionType)
			{
			case AuxiliarySelectType.eRectSelection:
				this.auxiliarySelection = new RectSelction(camdArgu);
				return;
			case AuxiliarySelectType.ePointSelection:
				this.auxiliarySelection = new PointSelection(camdArgu);
				return;
			case AuxiliarySelectType.eRoomorSpaceSelection:
				this.auxiliarySelection = new RoomOrSpaceSelction(camdArgu);
				return;
			case AuxiliarySelectType.eAnglePointSelection:
				this.auxiliarySelection = new AnglePointSelection(camdArgu);
				return;
			case AuxiliarySelectType.eElementSelection:
				this.auxiliarySelection = new ElementSelection(camdArgu);
				return;
			default:
				return;
			}
		}

		public bool Select()
		{
			return this.auxiliarySelection.Select();
		}

		private AuxiliarySelection auxiliarySelection;
	}
}
